<?php

/**
 * @author honestphan
 * @copyright 2012
 */
//G?i t?p tin giao di?n trong thu m?c view/theme/template tuong ?ng

defined('DSVH') or die('Restricted access');
include('model/m_home.php');
include('model/m_website.php');
include('model/m_phanmem.php');
include('controller/c_thongke.php');
include('controller/c_block.php');
$page = $_GET['act'];
   switch($page){
    
        case 'website':
        include('language/sanpham/lang_website.php');
        
         // kiem tra bien pages
        if($_REQUEST['page']==""){ $page = 1;}
        else{$page = $_REQUEST['page'];}
    
        //get input for class page
        $limit = 16;
        $start = ($page - 1) * $limit; 
        
        $list_website = getListwebsite($start,$limit);
        
        $total = total();
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=website&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
        
       	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/website.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
    
        case 'phanmem':
        include('language/sanpham/lang_phanmem.php');
        
         // kiem tra bien pages
        if($_REQUEST['page']==""){ $page = 1;}
        else{$page = $_REQUEST['page'];}
    
        //get input for class page
        $limit = 16;
        $start = ($page - 1) * $limit; 
        
        $list_phanmem = getListphanmem($start,$limit);
        
        $total = totalphanmem();
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=phanmem&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
        
        $title = home;
       	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/phanmem.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
    
    
        case 'loaiweb':
        include('language/sanpham/lang_loaiweb.php');
        $id = $_REQUEST['id'];
        $chitietloaiweb = getloaiwebsite($id);
        $title = "Mẫu ".$chitietloaiweb['ten_loai_website'];
         // kiem tra bien pages
        if($_REQUEST['page']==""){ $page = 1;}
        else{$page = $_REQUEST['page'];}
        //get input for class page
        $limit = 16;
        $start = ($page - 1) * $limit; 
        
        $list_website = getListwebsitecungloai($id, $start, $limit);
        
        $total = totalwebcungloai($id);
        
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=loaiweb&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
        
       	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/loaiweb.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
    
        case 'loaiphanmem':
        include('language/sanpham/lang_loaiphanmem.php');
        $id = $_REQUEST['id'];
        $chitietloaiphanmem = getloaiphanmem($id);
        $title = $chitietloaiphanmem['ten_loai_phan_mem'];
         // kiem tra bien pages
        if($_REQUEST['page']==""){ $page = 1;}
        else{$page = $_REQUEST['page'];}
        //get input for class page
        $limit = 16;
        $start = ($page - 1) * $limit; 
        
        $list_phanmem = getListphanmemcungloai($id, $start, $limit);
        
        $total = totalphanmemtheoloai($id);
        
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=loaiphanmem&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
        
       	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/loaiphanmem.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
    
    
    
        case 'webdetail':
        include('language/sanpham/lang_webdetail.php');
        
        $id = $_REQUEST['id'];
        
        $website_detail = getwebsite($id);
        
      
        
        $list_cungloai = getListwebsitecungloai($website_detail['loai_website_id'],0,20);
        
        $title = $website_detail['ten_website']." - ".$website_detail['ten_loai_website'];
        
        require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/webdetail.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
        
         case 'phanmemdetail':
        include('language/sanpham/lang_phanmemdetail.php');
        
        $id = $_REQUEST['id'];
        
        $phanmem_detail = getphanmem($id);
        
      
        
        $list_cungloai = getListphanmemcungloai($phanmem_detail['loai_phan_mem_id'],0,20);
        
        $title = $phanmem_detail['ten_phan_mem']." - ".$phanmem_detail['ten_loai_phan_mem'];
        
        require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/phanmemdetail.tpl');
    	require('view/theme/default/template/home/footer.tpl'); 
        break;
        
        
        
        case 'view':
       
    	//lấy danh sach bang tin
    	$list_bangtin = getListbangtin(0,5);
    	$list_lkw = getListlienketweb(0,10);
    	
    	//$list_tinhoatdong = getListtinhoatdong(1,3);
    	//$list_toptinhoatdong = getListtinhoatdong(0,1);
        if($_REQUEST['page']==""){
        $page = 1;
        $start =1;
        }
        else{
                
        $page = $_REQUEST['page'];
             
        }
       //get input for class page
        $limit = 20;
        $start = ($page - 1) * $limit;
        $list_chedosinhhoat = getListchedosinhhoat(0, 5);
        $list_phongnghi = getListphongnghi(0,10);
         
    	$list_mevabe = getListmevabe($start+1,$limit);
    	//$list_topmevabe = getListmevabe(0,1);
        $total = totalmevabe();
        // paging
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=list&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
       
        
        
        
        $id = $_REQUEST['id'];
        $mevabe_detail = getmevabe($id);
        if(!$mevabe_detail){
           header('LOCATION: index.php?module=home');  
           exit(); 
        }
        
       	$list_mevabelienquan = getListmevabelienquan(0,5, substr($mevabe_detail['ten_me_va_be'],0,8));
        
        
    	$heading_title= home;
        $title  = home." - ".$mevabe_detail['ten_me_va_be'];
        
    	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/detail.tpl');
    	require('view/theme/default/template/home/footer.tpl');    
        break;
        //case list
        case'list':
       
    	
        if($_REQUEST['page']==""){
        $page = 1;
        $start =1;
        }
        else{
                
        $page = $_REQUEST['page'];
             
        }
       //get input for class page
        $limit = 20;
        $start = ($page - 1) * $limit;
        
        $list_phanmem = getlistphanmem(0, 10);
        $list_website = getistwebsite(0,10);
         
    	$list_mevabe = getListmevabe($start,$limit);
    	//$list_topmevabe = getListmevabe(0,1);
         $total = totalmevabe();
        
        // paging
        $paging = new Pagination();
        $paging->total = $total;
        $paging->limit = $limit;
        $paging->url = "index.php?module=sanpham&act=list&page={page}";
        $paging->page = $page;
        $pagination = $paging->render();
       
       
        $title =home;
    	$heading_title=home;
        
    	require('view/theme/default/template/home/header.tpl'); 
    	require('view/theme/default/template/home/left.tpl'); 
    	require('view/theme/default/template/sanpham/list.tpl');
    	require('view/theme/default/template/home/footer.tpl');  
        break;
}
?>